﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="../NamedStyles/StandardColors.xaml" />
        <ResourceDictionary>
            <SolidColorBrush x:Key="TabControlNormalBorderBrush" Color="#8C8E94" />
            <Style x:Key="TabControlDeluxeStyle" TargetType="{x:Type TabControl}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type TabControl}">
                            <Grid ClipToBounds="true"
                                  KeyboardNavigation.TabNavigation="Local"
                                  SnapsToDevicePixels="true">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition x:Name="ColumnDefinition0" />
                                    <ColumnDefinition x:Name="ColumnDefinition1" Width="0" />
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition x:Name="RowDefinition0" Height="Auto" />
                                    <RowDefinition x:Name="RowDefinition1" Height="*" />
                                </Grid.RowDefinitions>
                                <TabPanel x:Name="HeaderPanel"
                                          Grid.Row="0"
                                          Grid.Column="0"
                                          Margin="0,2,210,0"
                                          Panel.ZIndex="1"
                                          IsItemsHost="true"
                                          KeyboardNavigation.TabIndex="1" />
                                <Border x:Name="ContentPanel"
                                        Grid.Row="1"
                                        Grid.Column="0"
                                        Background="{TemplateBinding Background}"
                                        BorderBrush="{TemplateBinding BorderBrush}"
                                        BorderThickness="{TemplateBinding BorderThickness}"
                                        CornerRadius="0,3,3,3"
                                        KeyboardNavigation.DirectionalNavigation="Contained"
                                        KeyboardNavigation.TabIndex="2"
                                        KeyboardNavigation.TabNavigation="Local">
                                    <ContentPresenter x:Name="PART_SelectedContentHost"
                                                      Margin="{TemplateBinding Padding}"
                                                      ContentSource="SelectedContent"
                                                      SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                                </Border>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!--  When the control has *keyboard* focus, draw a dashed box.  -->
            <Style x:Key="TabItemFocusVisual">
                <Setter Property="Control.Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <Rectangle Margin="3,3,3,1"
                                       SnapsToDevicePixels="true"
                                       Stroke="White"
                                       StrokeDashArray="1 2"
                                       StrokeThickness="1" />
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="TabItemDeluxeStyle" TargetType="{x:Type TabItem}">
                <Setter Property="FocusVisualStyle" Value="{StaticResource TabItemFocusVisual}" />
                <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                <Setter Property="VerticalContentAlignment" Value="Stretch" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type TabItem}">
                            <Grid Margin="0,0,3,0" SnapsToDevicePixels="true">
                                <Border x:Name="Bd"
                                        Margin="0,2,0,0"
                                        Background="{StaticResource BrushDarkMediumGrey}"
                                        BorderBrush="Transparent"
                                        BorderThickness="0"
                                        CornerRadius="3,3,0,0"
                                        Padding="5">
                                    <ContentPresenter x:Name="Content"
                                                      HorizontalAlignment="{Binding HorizontalContentAlignment,
                                                                                    RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"
                                                      VerticalAlignment="{Binding VerticalContentAlignment,
                                                                                  RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"
                                                      ContentSource="Header"
                                                      RecognizesAccessKey="True"
                                                      SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                                </Border>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="true">
                                    <Setter TargetName="Bd" Property="Background" Value="{StaticResource BrushLightMediumGrey}" />
                                </Trigger>
                                <Trigger Property="IsSelected" Value="true">
                                    <Setter Property="Panel.ZIndex" Value="1" />
                                    <Setter TargetName="Bd" Property="Background" Value="{StaticResource BrushMediumGrey}" />
                                    <!--  To make the tab taller when selected, remove the top margin and add content padding to make up for it.  -->
                                    <Setter TargetName="Bd" Property="Margin" Value="0" />
                                    <Setter TargetName="Bd" Property="Padding" Value="5,5,5,7" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </ResourceDictionary>
    </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>